from django.db import models
# Create your models here.
class User(models.Model):
    name = models.CharField(max_length=31, unique=True)
    email = models.CharField(max_length=63, unique=True)
    password = models.CharField(max_length=31)
    sex = models.CharField(max_length=8, default='空')
    height = models.FloatField(max_length=255, null=True)
    phone = models.IntegerField(null=True)
    education = models.CharField(max_length=255, default='空')
    school = models.CharField(max_length=255, default='空')
    address = models.CharField(max_length=255, default='空')
    skills = models.CharField(max_length=255, default='空')
    text = models.CharField(max_length=255, default='空')
    avatar = models.CharField(max_length=255, default='空')
    intended_position = models.CharField(max_length=255, default='')  # 新增意向岗位（可多个，逗号分割）



    def to_dict(self):
        return {
            'id': self.pk,
            'name': self.name,
            'email': self.email,
        }

    def info_to_dict(self):
        return {
            'id': self.pk,
            'name': self.name,
            'email': self.email,
            'sex': self.sex,
            'height': self.height,
            'phone': self.phone,
            'education': self.education,
            'school': self.school,
            'address': self.address,
            'skills': self.skills,
            'text': self.text,
            'intended_position': self.intended_position,   # 新增意向岗位
        }

